<template>
  <div>
    <el-button type="primary" @click="countChange">Primary</el-button>
    <div>Current Count: {{ store.count }}</div>
    <div>Current Num: {{ store.state.num }}</div>
  </div>
</template>

<script setup lang="ts">
  import { useStore } from '@/store/index'
  import $apiHttp from '@/api/index'


  const store = useStore()

  console.log('store------->', store)
  // store.count++
  // 自动补全！ ✨
  // 或使用 action 代替
  // store.increment()
  const countChange = async() => {
    // store.$patch({ count: store.count + 1 })
    // store.increment()
    try {
      const response = await $apiHttp.home.points();
      console.log(response.data);
    } catch (error) {
      console.error(error);
    }
    try {
      const response = await $apiHttp.server.ser();
      console.log('ser---->', response.data);
    } catch (error) {
      console.error(error);
    }
  }
</script>

<style scoped>

</style>
